package com.big.app.controller;

import com.big.app.entity.Urls;
import com.big.app.service.intf.UrlsService;
import com.big.app.vo1.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@CrossOrigin// 跨域
@Api(value = "用户注册操作",tags = "用户注册操作")
public class UrlsServlet {
    @Autowired
    private UrlsService service;
    @RequestMapping("/api/all.do")
    @ResponseBody
    public R a(){
        R all = service.all();
        System.out.println(all);
        return all;
    }

//    @RequestMapping("/api/all1.do")
//    @ResponseBody
//    public R a1(){
//        R all = service.all1();
//        System.out.println(all);
//        return all;
//    }

//    @RequestMapping("/api/all2.do")
//    @ResponseBody
//    public R a2(){
//        R all = service.all2();
//        System.out.println(all);
//        return all;
//    }

    @PostMapping("/api/update.do")
    @ResponseBody
    public R b(@RequestBody Urls urls){
        System.out.println(urls.getLikecount()+""+urls.getId());
       return service.update(urls);
    }

//    @PostMapping("/api/updates.do")
//    @ResponseBody
//
//    public R b1(@RequestBody Urls urls){
//        System.out.println(urls.getGztag()+""+urls.getId());
//        return service.update(urls);
//    }
//
//    @PostMapping("/api/updatee.do")
//    @ResponseBody
//    public R b2(@RequestBody Urls urls){
//        System.out.println(urls.getSctag()+""+urls.getId()+""+urls.getSccount());
//        return service.update(urls);
//    }

    @RequestMapping("/api/xhlist.do")
    @ResponseBody
    public R c(){
        R all = service.xhlist();
        System.out.println(all);
        return all;
    }

    @PostMapping("/api/sousuo.do")
    @ResponseBody
    public R d(@RequestBody Urls urls){

        //System.out.println(urls.getUser());
        return service.sousuo(urls);
    }

}
